/*
    This file is part of p4f
    Copyright (C) 2009  Sebastian Fernandez

    p4f is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as 
    published by the Free Software Foundation, either version 3 of the 
    License, or (at your option) any later version.

    p4f is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*/

#ifndef _NATIVE_H_
#define _NATIVE_H_

/* Windows */
#ifdef _WIN32

#include <winsock2.h>
#ifdef __MINGW32__
	//Your code may not work for win2000 or less
	#undef _WIN32_WINNT
	#define _WIN32_WINNT 0x0501
	#include <ws2tcpip.h>
#else
	#include <Ws2def.h>
#endif
#include <windows.h>

#define socklen_t int

#define DIR_CH_S "\\"
#define DIR_CH '\\'
#define CH_IS_DIR(s) s=='\\'

#define itoa_t(a,b) itoa(a,b,10)
/* ----------------- */

/* Linux and *nix */
#else
#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <dirent.h>
#include <unistd.h>

typedef int SOCKET;
#define closesocket(s) close(s)

#define DIR_CH_S "/"
#define DIR_CH '/'
#define CH_IS_DIR(s) s=='/'

#define itoa_t(a,b) itoa(a,b)
void itoa(int ,char s[]);
void reverse(char s[]);
void itoa_t(int num,char *buf);

/* ----------------- */
#endif

#endif /* _NATIVE_H_ */
